package com.yami.shop.dao;

import com.yami.shop.bean.model.ViewUserRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 浏览用户记录 Mapper 接口
 * </p>
 *
 * @author chajiu
 * @since 2021-06-30
 */
public interface ViewUserRecordMapper extends BaseMapper<ViewUserRecord> {

    @Results(
            value = {
                    @Result(column = "looked_user_id",property = "user",one = @One(select = "com.yami.shop.dao.UserMapper.getUserById",fetchType = FetchType.EAGER))
            }
    )
    //查询谁看过我
    @Select("select * from ch_view_user_record where looked_user_id = #{lookedUserId} order by create_time desc")
    List<ViewUserRecord> queryViewUser(@Param("lookedUserId") String lookedUserId);
}
